package net.mhelvens.deltaprofiles;

import java.util.Set;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

abstract public class ReceiverMonitor<T extends Object> extends BaseMonitor {
	@SuppressWarnings("unused") private static final String TAG = ReceiverMonitor.class.getSimpleName();
	
	public static final String ACTION_NOTIFY = "net.mhelvens.deltaprofiles.ACTION_NOTIFY";
	
	private MonitoringReceiver receiver;
	
	@Override
	protected void onStart() {
		receiver = new MonitoringReceiver();
		for (String action : broadcastActions())
			registerReceiver(receiver, new IntentFilter(action));
	}
	
	@Override
	protected void onStop() {
		unregisterReceiver(receiver);
		receiver = null;
		
		super.onStop();
	}
	
	abstract protected Set<String> broadcastActions();
	
	private class MonitoringReceiver extends BroadcastReceiver {
		@Override
		public void onReceive(Context context, Intent intent) {
			
			// TODO
		}
	}
}
